package com.djl.sqtg.service.impl;

import com.djl.sqtg.entity.*;
import com.djl.sqtg.mapper.UserMapper;
import com.djl.sqtg.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/** 处理用户数据的业务层实现类 */
@Service
public class UserServiceImpl implements IUserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public Integer register(String username, String avatar, String openid, String registertime) {
        return userMapper.register(username,avatar,openid,registertime);}

    @Override
    public User findOpenid(String openid) {
        return userMapper.findOpenid(openid);
    }


    @Override
    public User getByUid(Integer uid) {

        return null;
    }

    @Override
    public List<User> findByUsername(String username) {
        return userMapper.findByUsername(username);
    }


    public Integer getAllUsers() {
        return userMapper.getAllUsers();
    }

    @Override
    public List<User> getAllUser() {
        return userMapper.getAllUser();
    }

    @Override
    public Integer getAllUsersByTzid(Integer tzid) {
        return userMapper.getAllUsersByTzid(tzid);
    }

    @Override
    public Integer getUserBySearchCount(String startDate, String endDate, String username, String telep,Integer memberstate) {
        return userMapper.getUserBySearchCount(startDate,endDate,username,telep,memberstate);
    }


//    @Override
//    public Integer getUserBySearchCount(Date startDate, Date endDate, String username, String telep) {
//        return userMapper.getUserBySearchCount(startDate,endDate,username,telep);
//    }

//    @Override
//    public Integer getUserBySearchCount(List<String> dateList, String username, String telep) {
//        return userMapper.getUserBySearchCount(dateList,username,telep);
//    }


    @Override
    public Integer delUserByUid(Integer uid) {
        return userMapper.delUserByUid(uid);
    }

    @Override
    public Integer delManyUsers(Integer[] uid) {return userMapper.delManyUsers(uid);}

    @Override
    public List<User> getUserByPageNum(Integer pageNum, Integer pageSize) {
        return userMapper.getUserByPageNum(pageNum,pageSize);
    }

    @Override
    public List<User> getGroupByTzid(Integer pageNum, Integer pageSize, Integer tzid) {
        return userMapper.getGroupByTzid(pageNum,pageSize,tzid);
    }

    @Override
    public List<User> getUserBySearch(String startDate, String endDate, String username, String telep,Integer memberstate, Integer pageNum, Integer pageSize) {
        return userMapper.getUserBySearch(startDate,endDate,username,telep,memberstate,pageNum,pageSize);
    }

    @Override
    public Integer userNewAdd(String date) {
        return userMapper.userNewAdd(date);
    }

    @Override
    public Integer userNum() {
        return userMapper.userNum();
    }

    @Override
    public Integer memberNum() {
        return userMapper.memberNum();
    }

    @Override
    public Integer memberNewAdd(String date) {
        return userMapper.memberNewAdd(date);
    }

    @Override
    public Integer userNewAddTimePeriod(String startDate, String endDate) {
        return userMapper.userNewAddTimePeriod(startDate,endDate);
    }

    @Override
    public Integer memberNewAddTimePeriod(String startDate, String endDate) {
        return userMapper.memberNewAddTimePeriod(startDate,endDate);
    }

    @Override
    public List<Colonel> getColonelAddress() {
        return userMapper.getColonelAddress();
    }

    @Override
    public Integer chooeseColonel(Integer uid,Integer tzid) {
        return userMapper.chooeseColonel(uid,tzid);
    }

    @Override
    public Integer footprint(Integer uid, Integer gid, String browsetime) {
        return userMapper.footprint(uid,gid,browsetime);
    }

    @Override
    public List<Goods> getFootprintByUid(Integer uid) {
        return userMapper.getFootprintByUid(uid);
    }

    @Override
    public Integer collection(Integer uid, Integer gid, String collectiontime) {
        return userMapper.collection(uid,gid,collectiontime);
    }

    @Override
    public Collection getCollection(Integer uid, Integer gid) {
        return userMapper.getCollection(uid,gid);
    }

    @Override
    public List<Collection> getAllCollection(Integer uid) {
        return userMapper.getAllCollection(uid);
    }

    @Override
    public Integer delCollection(Integer cid) {
        return userMapper.delCollection(cid);
    }

    @Override
    public Integer delCollectionByUidGid(Integer uid, Integer gid) {
        return userMapper.delCollectionByUidGid(uid,gid);
    }

    @Override
    public List<Coupon> getCoupon() {
        return userMapper.getCoupon();
    }

    @Override
    public Integer updateTzidNull(Integer uid) {
        return userMapper.updateTzidNull(uid);
    }

//    @Override
//    public List<User> getUserBySearch(Date startDate, Date endDate, String username, String telep, Integer pageNum, Integer pageSize) {
//        return userMapper.getUserBySearch(startDate,endDate,username,telep,pageNum,pageSize);
//    }

//    @Override
//    public List<User> getUserBySearch(List<String> dateList, String username, String telep, Integer pageNum, Integer pageSize) {
//        return userMapper.getUserBySearch(dateList,username,telep,pageNum,pageSize);
//    }


    @Override
    public List<User> getUserBySearchTzid(String username, String telep, Integer pageNum, Integer pageSize, Integer tzid) {
        return userMapper.getUserBySearchTzid(username,telep,pageNum,pageSize,tzid);
    }

    @Override
    public Integer getUserBySearchCountTzid(String username, String telep, Integer tzid) {
        return userMapper.getUserBySearchCountTzid(username,telep,tzid);
    }


}
